﻿using Microsoft.Xna.Framework;
using OilRigSumoWrestlers.Scenes.Menu;
using RaptorEngine;
using RaptorEngine.Components;
using RaptorEngine.Managers;

namespace OilRigSumoWrestlers.Controllables.Controllers
{
    public class MenuControllable:Controllable
    {
        private MenuScene _menu;
        private LogicalPlayerIndex _player;

        public MenuControllable(Entity entity, MenuScene menu, LogicalPlayerIndex player) 
            : base(entity)
        {
            _player = player;
            _menu = menu;
        }

        public override void Update(GameTime time)
        {

            if (GameEngine.Instance.Input.CommandActive(GameConstant.MENU_FORWARD + _player.ToString()))
            {
                _menu.GoForward();
            }
            else if (GameEngine.Instance.Input.CommandActive(GameConstant.MENU_BACK + _player.ToString()))
            {
                _menu.GoBack();
            }
            else if (GameEngine.Instance.Input.CommandActive(GameConstant.MENU_NEXT + _player.ToString()))
            {
                _menu.SelectNext();
            }
            else if (GameEngine.Instance.Input.CommandActive(GameConstant.MENU_PREVIOUS + _player.ToString()))
            {
                _menu.SelectPrevious();
            }
        }

    }
}
